package org.lq.dlz.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.lq.dlz.dao.Coupon_productDao;
import org.lq.dlz.entity.Coupon_product;
import org.lq.dlz.util.JDBCUtils;

public class Coupon_productDaoImpl implements Coupon_productDao {
	private QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());
	@Override
	public int addCoupon_product(Coupon_product product) {
		String sql="INSERT INTO `dlz_shopping`.`coupon_product`(`coupon_id`, `product_id`, `product_name`) VALUES (?,?,?)";
		try {
			return qr.update(sql, product.getCoupon_id(),product.getProduct_id(),product.getProduct_name());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return 0;
	}

}
